package logrus.beanmock.invoker;


public class MethodInvocationInfo {

    private final MethodInvoker invoker;

    private final int maxCount;

    private final String methodName;

    private final int minCount;

    private final String scenario;

    private final Class<?> targetClass;

    public MethodInvocationInfo(final Class<?> targetClass, final String methodName,
            final MethodInvoker invoker, final int min, final int max, final String scenario) {
        if (targetClass == null) throw new NullPointerException("targetClass");
        if (methodName == null) throw new NullPointerException("methodName");
        if (invoker == null) throw new NullPointerException("invoker");
        if (scenario == null) throw new NullPointerException("scenario");
        if (min < 0) throw new IllegalArgumentException("min < 0");
        if (max < min) throw new IllegalArgumentException("max < min");

        this.targetClass = targetClass;
        this.methodName = methodName;
        this.invoker = invoker;
        this.minCount = min;
        this.maxCount = max;
        this.scenario = scenario;
    }

    public Counter getCounter() {
        return new Counter(minCount, maxCount);
    }

    public MethodInvoker getInvoker() {
        return invoker;
    }

    public String getMethodName() {
        return methodName;
    }

    public String getScenario() {
        return scenario;
    }

    public Class<?> getTargetClass() {
        return targetClass;
    }

    public int getMaxCount() {
        return maxCount;
    }

    public int getMinCount() {
        return minCount;
    }

}
